{include file="public/header" /}
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
    <form action="{:url('save')}" class="layui-form" lay-filter="builderForm" data-token="{$builderTableToken}" data-nav="{$navTitle}" data-just="{$just}">
        <input type="hidden" name="type_id" value="3">
        <div class="layui-card">
            <div class="layui-card-body">
                <div class="layui-row">
                    <div class="layui-col-xs12 layui-col-sm12 layui-col-md6">
                        <div class="layui-form-item">
                            <label class="layui-form-label">通知会员</label>
                            <div class="layui-input-block">
                                <div class="choose-user-card" lay-click="choose">
                                    <div class="empty"></div>
                                </div>
                            </div>
                        </div>
                    </div>

                    {:builderFormInit([
                        'title' => '标题',
                        'name' => 'title',
                        'req'=> true
                    ])->getFormItemInputHtml()}

                    {:builderFormInit([
                        'title' => '内容',
                        'name' => 'content',
                        'req'=> true
                    ])->getFormItemTextareaHtml()}
                </div>
            </div>
        </div>
        {include file="public/submit" /}
    </form>
</div>
</body>
{include file="public/footer" /}
<script type="text/html" id="userTpl">
    <input type="hidden" name="uid" value="{{d.id}}">
    <div class="avatar">
        <img src="{{d.photo}}">
    </div>
    <div class="user-info">
        <div class="nickname">{{d.code}} - {{d.nickname}}</div>
        <div class="phone">{{d.mobile}}</div>
    </div>
</script>
<script>
    layui.use(['jquery', 'methods', 'edit', 'laytpl'], function () {
        const jquery = layui.jquery,
            methods = layui.methods,
            edit = layui.edit,
            laytpl = layui.laytpl;
        edit.render();
        methods.event.click('choose', () => {
            methods.openTableLayer({title: '选择会员', url: '{:url("user/choose")}', row: true}, (data) => {
                laytpl(jquery('#userTpl').html()).render(data, function (html) {
                    jquery('.choose-user-card').html(html);
                });
            });
        });
    });
</script>
</html>